From: Matthias Klose Date: Tue, 14 Apr 2026 04:38:32 +0000 (+0700) Subject: langpack-gettext X-Git-Tag: archive/raspbian/3.9.2-1+rpi1+deb11u6^2~82 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com//%22mailto:nienhueser%40kde.org/%22/%22http:/www.example.com/%22mailto:nienhueser%40kde.org/%22?a=commitdiff_plain;h=7d4b1cfd93d2c6fb7778344de59eea084332358a;p=python3.9.git langpack-gettext # DP: Description: support alternative gettext tree in # DP: /usr/share/locale-langpack; if a file is present in both trees, # DP: prefer the newer one # DP: Upstream status: Ubuntu-Specific # DP: Description: support alternative gettext tree in # DP: /usr/share/locale-langpack; if a file is present in both trees, # DP: prefer the newer one # DP: Upstream status: Ubuntu-Specific Gbp-Pq: Name langpack-gettext.diff --- diff --git a/Lib/gettext.py b/Lib/gettext.py index 77b67ae..c869b83 100644 --- a/Lib/gettext.py +++ b/Lib/gettext.py @@ -567,11 +567,26 @@ def find(domain, localedir=None, languages=None, all=False): if lang == 'C': break mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain) + mofile_lp = os.path.join("/usr/share/locale-langpack", lang, + 'LC_MESSAGES', '%s.mo' % domain) + + # first look into the standard locale dir, then into the + # langpack locale dir + + # standard mo file if os.path.exists(mofile): if all: result.append(mofile) else: return mofile + + # langpack mofile -> use it + if os.path.exists(mofile_lp): + if all: + result.append(mofile_lp) + else: + return mofile_lp + return result